﻿using Shinva.LADModel.Models;
using Shinva.Variables.Models;
using Shinva.Variables.Type.combination;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Shinva.PLCModel.Models
{


  public class PlcFB
    {

        #region 变量表快速访问属性

        //输入变量列表
        public PlcStruct InputStruct { get; set; } = new PlcStruct() { Name = "Input"};

        //输出变量列表
        public PlcStruct OutputStruct { get; set; } = new PlcStruct() { Name = "Output" };

        //可返回变量列表
        public PlcStruct InOutStruct { get; set; } = new PlcStruct() { Name = "InOut" };

        //静态变量列表
        public PlcStruct StaticStruct { get; set; } = new PlcStruct() { Name = "Static" };

        // 临时变量列表
        public PlcStruct TempStruct { get; set; } = new PlcStruct() { Name = "Temp" };

        // 常量列表
        public PlcStruct ConstantStruct { get; set; } = new PlcStruct() { Name = "Constant" };

        #endregion



        /// <summary>
        /// 这个是绑定的实例背景数据块
        /// </summary>
        public NormalVariableTable DBInstance { get; set; }

        /// <summary>
        /// 这个是变量表接口，就是函数的形参部分
        /// </summary>
        public VariableTableInterface variableTableInterface { get; set; } = new VariableTableInterface();

        public NormalVariableTable InterfaceVariableTable { get;set; } = new NormalVariableTable();

        /// <summary>
        /// 这是FB块中的梯形图了
        /// </summary>
        public Diagram LADTree { get; set; } = new Diagram();

        /// <summary>
        /// 编程语言，默认为LAD梯形图
        /// </summary>
        public ProgrammingLanguage ProgrammingLanguage { get; set; } = ProgrammingLanguage.LAD;

        /// <summary>
        /// 程序名
        /// </summary>
        public string Name { get; set; }

        /// <summary>
        /// 程序编号
        /// </summary>
        public int Number { get; set; }

        public PlcFB(ProgrammingLanguage language,int number,string name)
        {
            //构建变量表

            //构建程序信息
            Number = number;
            Name = name + "[" + "FB" + number + "]";
        }
    }
}
